www.gusucode.com > VC 模拟银行系统ATM自动取款机-源码程序 > VC 模拟银行系统ATM自动取款机-源码程序/code/bank.cpp

    //Download by http://www.NewXing.com
// **************************************************************************
//
// This File Is Automatically Generated by the InterBusIDL-to-C++ Compiler !
//
// Copyright (c) 2000
// Intervision Software Co., Ltd.
// Haidian District, Beijing.
//
// All Rights Reserved
//
// *************************************************************************

// Version: 4.0.0

#include "StdAfx.h"

#include <STAR/CORBAClient.h>
#include <STAR/CORBAServer.h>
#include <bank.h>

STAR::TypeCodeConst _tc_BankAccount(
"0150fd7f0e0000002c00000001ef12001400000049444c3a42616e6b4163636f756e743a312e3"
"0000c00000042616e6b4163636f756e7400"
);

//
// Interface declare ::BankAccount
//
const char* BankAccount::ids_[] =
{
    "IDL:BankAccount:1.0",
    0
};

void
STARDuplicate(BankAccount_ptr p)
{
    if(p)
        p -> _STAR_incRef();
}

void
STARRelease(BankAccount_ptr p)
{
    if(p)
        p -> _STAR_decRef();
}

BankAccount_ptr
BankAccount::_narrow(CORBA::Object_ptr p)
{
    if(!CORBA::is_nil(p))
    {
        BankAccount_ptr v = dynamic_cast<BankAccount_ptr>(p);
        if(v)
            return _duplicate(v);

        if(p -> _is_a(ids_[0]))
        {
            BankAccount_ptr val = new BankAccount;
            val -> _STAR_copyFrom(p);
            return val;
        }
    }

    return _nil();
}

BankAccount_ptr
BankAccount::_narrow(CORBA::AbstractBase_ptr p)
{
    if(!CORBA::is_nil(p))
    {
        CORBA::Object_var obj = p -> _to_object();
        return _narrow(obj);
    }
    return _nil();
}

const char**
BankAccount::_STAR_ids() const
{
    return ids_;
}

const char**
BankAccount::_STAR_staticIds()
{
    return ids_;
}

void
STARMarshal(BankAccount_ptr _star_v, STAR::OutputStreamImpl* _star_out)
{
    _star_out -> write_Object(_star_v);
}

void
STARUnmarshal(BankAccount_ptr& _star_v, STAR::InputStreamImpl* _star_in)
{
    BankAccount_var old = _star_v;
    CORBA::Object_var p = _star_in -> read_Object();

    if(!CORBA::is_nil(p))
    {
        _star_v = new BankAccount;
        _star_v -> _STAR_copyFrom(p);
    }
    else
        _star_v = BankAccount::_nil();
}

void
operator<<=(CORBA::Any& any, BankAccount_ptr* v)
{
    any.replace(_tc_BankAccount, (CORBA::Object_ptr)*v, true);
}

void
operator<<=(CORBA::Any& any, BankAccount_ptr v)
{
    BankAccount_ptr val = BankAccount::_duplicate(v);
    any <<= &val;
}

CORBA::Boolean
operator>>=(const CORBA::Any& any, BankAccount_ptr& v)
{
    if(any.check_type(_tc_BankAccount))
    {
        CORBA::Object_ptr val = (CORBA::Object_ptr)any.value();

        if(!CORBA::is_nil(val))
        {
            if(!(v = dynamic_cast<BankAccount_ptr>(val)))
            {
                v = new BankAccount;
                v -> _STAR_copyFrom(val);
                (CORBA::Any&)any <<= &v;
            }
        }
        else
            v = BankAccount::_nil();

        return true;
    }
    else
        return false;
}

//
// Operation declare ::BankAccount::log
//
CORBA::Boolean
BankAccount::log(const char* _star_a0)
{
    bool _star_retry = true;
    while(true)
    {
        STAR::StubBase_var _star_stubBase = _STAR_getStub();
        try
        {
            STAR::MarshalStub_ptr _star_stub = dynamic_cast<STAR::MarshalStub_ptr>(_star_stubBase.in());
            if (_star_stub!=NULL)
            {
                for(;;)
                {
                    STAR::Downcall_var _star_down = _star_stub->_STAR_createDowncall("log", true);
                    try
                    {
                        STAR::OutputStreamImpl* _star_out = _star_stub->_STAR_prePrepareHeader(_star_down);
                        try
                        {
                            _star_out -> write_string(_star_a0);
                        }
                        catch(const CORBA::SystemException& _star_ex)
                        {
                            _star_stub->_STAR_marshalEx(_star_down, _star_ex);
                        }
                        _star_stub->_STAR_postPrepareHeader(_star_down);
                        _star_stub->_STAR_request(_star_down);
                        bool _star_uex;
                        STAR::InputStreamImpl* _star_in = _star_stub->_STAR_preRemoveHeader(_star_down, _star_uex);
                        if(_star_uex)
                        {
                            _star_stub->_STAR_postRemoveHeader(_star_down);
                        }
                        else
                        {
                            CORBA::Boolean _star_r;
                            try
                            {
                                _star_r = _star_in -> read_boolean();
                            }
                            catch(const CORBA::SystemException& _star_ex)
                            {
                                _star_stub->_STAR_unmarshalEx(_star_down, _star_ex);
                            }
                            _star_stub->_STAR_postRemoveHeader(_star_down);
                            return _star_r;
                        }
                    }
                    catch(const STAR::FailureException& _star_ex)
                    {
                        _star_stub->_STAR_handleNetworkFailureException(_star_down, _star_ex);
                    }
                }
            }
            else
            {
                throw CORBA::INV_OBJREF();
            }
        }
        catch(const STAR::ExceptionBase& _star_ex)
        {
            _STAR_handleException(_star_ex, _star_retry);
        }
    }
}

//
// Operation declare ::BankAccount::authentificate
//
CORBA::Boolean
BankAccount::authentificate(const char* _star_a0)
{
    bool _star_retry = true;
    while(true)
    {
        STAR::StubBase_var _star_stubBase = _STAR_getStub();
        try
        {
            STAR::MarshalStub_ptr _star_stub = dynamic_cast<STAR::MarshalStub_ptr>(_star_stubBase.in());
            if (_star_stub!=NULL)
            {
                for(;;)
                {
                    STAR::Downcall_var _star_down = _star_stub->_STAR_createDowncall("authentificate", true);
                    try
                    {
                        STAR::OutputStreamImpl* _star_out = _star_stub->_STAR_prePrepareHeader(_star_down);
                        try
                        {
                            _star_out -> write_string(_star_a0);
                        }
                        catch(const CORBA::SystemException& _star_ex)
                        {
                            _star_stub->_STAR_marshalEx(_star_down, _star_ex);
                        }
                        _star_stub->_STAR_postPrepareHeader(_star_down);
                        _star_stub->_STAR_request(_star_down);
                        bool _star_uex;
                        STAR::InputStreamImpl* _star_in = _star_stub->_STAR_preRemoveHeader(_star_down, _star_uex);
                        if(_star_uex)
                        {
                            _star_stub->_STAR_postRemoveHeader(_star_down);
                        }
                        else
                        {
                            CORBA::Boolean _star_r;
                            try
                            {
                                _star_r = _star_in -> read_boolean();
                            }
                            catch(const CORBA::SystemException& _star_ex)
                            {
                                _star_stub->_STAR_unmarshalEx(_star_down, _star_ex);
                            }
                            _star_stub->_STAR_postRemoveHeader(_star_down);
                            return _star_r;
                        }
                    }
                    catch(const STAR::FailureException& _star_ex)
                    {
                        _star_stub->_STAR_handleNetworkFailureException(_star_down, _star_ex);
                    }
                }
            }
            else
            {
                throw CORBA::INV_OBJREF();
            }
        }
        catch(const STAR::ExceptionBase& _star_ex)
        {
            _STAR_handleException(_star_ex, _star_retry);
        }
    }
}

//
// Operation declare ::BankAccount::requery
//
CORBA::Double
BankAccount::requery()
{
    bool _star_retry = true;
    while(true)
    {
        STAR::StubBase_var _star_stubBase = _STAR_getStub();
        try
        {
            STAR::MarshalStub_ptr _star_stub = dynamic_cast<STAR::MarshalStub_ptr>(_star_stubBase.in());
            if (_star_stub!=NULL)
            {
                for(;;)
                {
                    STAR::Downcall_var _star_down = _star_stub->_STAR_createDowncall("requery", true);
                    try
                    {
                        _star_stub->_STAR_prePrepareHeader(_star_down);
                        _star_stub->_STAR_postPrepareHeader(_star_down);
                        _star_stub->_STAR_request(_star_down);
                        bool _star_uex;
                        STAR::InputStreamImpl* _star_in = _star_stub->_STAR_preRemoveHeader(_star_down, _star_uex);
                        if(_star_uex)
                        {
                            _star_stub->_STAR_postRemoveHeader(_star_down);
                        }
                        else
                        {
                            CORBA::Double _star_r;
                            try
                            {
                                _star_r = _star_in -> read_double();
                            }
                            catch(const CORBA::SystemException& _star_ex)
                            {
                                _star_stub->_STAR_unmarshalEx(_star_down, _star_ex);
                            }
                            _star_stub->_STAR_postRemoveHeader(_star_down);
                            return _star_r;
                        }
                    }
                    catch(const STAR::FailureException& _star_ex)
                    {
                        _star_stub->_STAR_handleNetworkFailureException(_star_down, _star_ex);
                    }
                }
            }
            else
            {
                throw CORBA::INV_OBJREF();
            }
        }
        catch(const STAR::ExceptionBase& _star_ex)
        {
            _STAR_handleException(_star_ex, _star_retry);
        }
    }
}

//
// Operation declare ::BankAccount::withdraw
//
CORBA::Boolean
BankAccount::withdraw(CORBA::Short _star_a0)
{
    bool _star_retry = true;
    while(true)
    {
        STAR::StubBase_var _star_stubBase = _STAR_getStub();
        try
        {
            STAR::MarshalStub_ptr _star_stub = dynamic_cast<STAR::MarshalStub_ptr>(_star_stubBase.in());
            if (_star_stub!=NULL)
            {
                for(;;)
                {
                    STAR::Downcall_var _star_down = _star_stub->_STAR_createDowncall("withdraw", true);
                    try
                    {
                        STAR::OutputStreamImpl* _star_out = _star_stub->_STAR_prePrepareHeader(_star_down);
                        try
                        {
                            _star_out -> write_short(_star_a0);
                        }
                        catch(const CORBA::SystemException& _star_ex)
                        {
                            _star_stub->_STAR_marshalEx(_star_down, _star_ex);
                        }
                        _star_stub->_STAR_postPrepareHeader(_star_down);
                        _star_stub->_STAR_request(_star_down);
                        bool _star_uex;
                        STAR::InputStreamImpl* _star_in = _star_stub->_STAR_preRemoveHeader(_star_down, _star_uex);
                        if(_star_uex)
                        {
                            _star_stub->_STAR_postRemoveHeader(_star_down);
                        }
                        else
                        {
                            CORBA::Boolean _star_r;
                            try
                            {
                                _star_r = _star_in -> read_boolean();
                            }
                            catch(const CORBA::SystemException& _star_ex)
                            {
                                _star_stub->_STAR_unmarshalEx(_star_down, _star_ex);
                            }
                            _star_stub->_STAR_postRemoveHeader(_star_down);
                            return _star_r;
                        }
                    }
                    catch(const STAR::FailureException& _star_ex)
                    {
                        _star_stub->_STAR_handleNetworkFailureException(_star_down, _star_ex);
                    }
                }
            }
            else
            {
                throw CORBA::INV_OBJREF();
            }
        }
        catch(const STAR::ExceptionBase& _star_ex)
        {
            _STAR_handleException(_star_ex, _star_retry);
        }
    }
}

//
// Operation declare ::BankAccount::deposit
//
CORBA::Boolean
BankAccount::deposit(CORBA::Short _star_a0)
{
    bool _star_retry = true;
    while(true)
    {
        STAR::StubBase_var _star_stubBase = _STAR_getStub();
        try
        {
            STAR::MarshalStub_ptr _star_stub = dynamic_cast<STAR::MarshalStub_ptr>(_star_stubBase.in());
            if (_star_stub!=NULL)
            {
                for(;;)
                {
                    STAR::Downcall_var _star_down = _star_stub->_STAR_createDowncall("deposit", true);
                    try
                    {
                        STAR::OutputStreamImpl* _star_out = _star_stub->_STAR_prePrepareHeader(_star_down);
                        try
                        {
                            _star_out -> write_short(_star_a0);
                        }
                        catch(const CORBA::SystemException& _star_ex)
                        {
                            _star_stub->_STAR_marshalEx(_star_down, _star_ex);
                        }
                        _star_stub->_STAR_postPrepareHeader(_star_down);
                        _star_stub->_STAR_request(_star_down);
                        bool _star_uex;
                        STAR::InputStreamImpl* _star_in = _star_stub->_STAR_preRemoveHeader(_star_down, _star_uex);
                        if(_star_uex)
                        {
                            _star_stub->_STAR_postRemoveHeader(_star_down);
                        }
                        else
                        {
                            CORBA::Boolean _star_r;
                            try
                            {
                                _star_r = _star_in -> read_boolean();
                            }
                            catch(const CORBA::SystemException& _star_ex)
                            {
                                _star_stub->_STAR_unmarshalEx(_star_down, _star_ex);
                            }
                            _star_stub->_STAR_postRemoveHeader(_star_down);
                            return _star_r;
                        }
                    }
                    catch(const STAR::FailureException& _star_ex)
                    {
                        _star_stub->_STAR_handleNetworkFailureException(_star_down, _star_ex);
                    }
                }
            }
            else
            {
                throw CORBA::INV_OBJREF();
            }
        }
        catch(const STAR::ExceptionBase& _star_ex)
        {
            _STAR_handleException(_star_ex, _star_retry);
        }
    }
}

//
// Operation declare ::BankAccount::alterPAW
//
CORBA::Boolean
BankAccount::alterPAW(const char* _star_a0)
{
    bool _star_retry = true;
    while(true)
    {
        STAR::StubBase_var _star_stubBase = _STAR_getStub();
        try
        {
            STAR::MarshalStub_ptr _star_stub = dynamic_cast<STAR::MarshalStub_ptr>(_star_stubBase.in());
            if (_star_stub!=NULL)
            {
                for(;;)
                {
                    STAR::Downcall_var _star_down = _star_stub->_STAR_createDowncall("alterPAW", true);
                    try
                    {
                        STAR::OutputStreamImpl* _star_out = _star_stub->_STAR_prePrepareHeader(_star_down);
                        try
                        {
                            _star_out -> write_string(_star_a0);
                        }
                        catch(const CORBA::SystemException& _star_ex)
                        {
                            _star_stub->_STAR_marshalEx(_star_down, _star_ex);
                        }
                        _star_stub->_STAR_postPrepareHeader(_star_down);
                        _star_stub->_STAR_request(_star_down);
                        bool _star_uex;
                        STAR::InputStreamImpl* _star_in = _star_stub->_STAR_preRemoveHeader(_star_down, _star_uex);
                        if(_star_uex)
                        {
                            _star_stub->_STAR_postRemoveHeader(_star_down);
                        }
                        else
                        {
                            CORBA::Boolean _star_r;
                            try
                            {
                                _star_r = _star_in -> read_boolean();
                            }
                            catch(const CORBA::SystemException& _star_ex)
                            {
                                _star_stub->_STAR_unmarshalEx(_star_down, _star_ex);
                            }
                            _star_stub->_STAR_postRemoveHeader(_star_down);
                            return _star_r;
                        }
                    }
                    catch(const STAR::FailureException& _star_ex)
                    {
                        _star_stub->_STAR_handleNetworkFailureException(_star_down, _star_ex);
                    }
                }
            }
            else
            {
                throw CORBA::INV_OBJREF();
            }
        }
        catch(const STAR::ExceptionBase& _star_ex)
        {
            _STAR_handleException(_star_ex, _star_retry);
        }
    }
}

//
// Operation declare ::BankAccount::leave
//
CORBA::Boolean
BankAccount::leave()
{
    bool _star_retry = true;
    while(true)
    {
        STAR::StubBase_var _star_stubBase = _STAR_getStub();
        try
        {
            STAR::MarshalStub_ptr _star_stub = dynamic_cast<STAR::MarshalStub_ptr>(_star_stubBase.in());
            if (_star_stub!=NULL)
            {
                for(;;)
                {
                    STAR::Downcall_var _star_down = _star_stub->_STAR_createDowncall("leave", true);
                    try
                    {
                        _star_stub->_STAR_prePrepareHeader(_star_down);
                        _star_stub->_STAR_postPrepareHeader(_star_down);
                        _star_stub->_STAR_request(_star_down);
                        bool _star_uex;
                        STAR::InputStreamImpl* _star_in = _star_stub->_STAR_preRemoveHeader(_star_down, _star_uex);
                        if(_star_uex)
                        {
                            _star_stub->_STAR_postRemoveHeader(_star_down);
                        }
                        else
                        {
                            CORBA::Boolean _star_r;
                            try
                            {
                                _star_r = _star_in -> read_boolean();
                            }
                            catch(const CORBA::SystemException& _star_ex)
                            {
                                _star_stub->_STAR_unmarshalEx(_star_down, _star_ex);
                            }
                            _star_stub->_STAR_postRemoveHeader(_star_down);
                            return _star_r;
                        }
                    }
                    catch(const STAR::FailureException& _star_ex)
                    {
                        _star_stub->_STAR_handleNetworkFailureException(_star_down, _star_ex);
                    }
                }
            }
            else
            {
                throw CORBA::INV_OBJREF();
            }
        }
        catch(const STAR::ExceptionBase& _star_ex)
        {
            _STAR_handleException(_star_ex, _star_retry);
        }
    }
}